import request from '@/utils/request'

// // 查询合同列表
// export function listContract(query) {
//   return request({
//     url: '/fabricContract/list',
//     method: 'get',
//     params: query
//   })
// }

// 查询合同详细
export function getContractById(contractId) {
  return request({
    url: '/fabricContract/' + contractId,
    method: 'get'
  })
}

// 新增合同
export function addContract(data) {
  return request({
    url: '/fabricContract/create/',
    method: 'put',
    data: data
  })
}

// 修改合同
export function updateContract(data) {
  return request({
    url: '/fabricContract/update/',
    method: 'post',
    data: data
  })
}

// 删除合同
export function deleteContract(contractId) {
  return request({
    url: '/fabricContract/delete' + contractId,
    method: 'delete'
  })
}

// 按货主和合同类型查询合同
export function getContractByOwnerAndType(owner, contractType) {
  return request({
    url: `/fabricContract/owner/${owner}/type/${contractType}`,
    method: 'get'
  })
}
